package com.css.zfzx.sjcj.common.division;

import java.util.Arrays;

/**
 * <p>直辖市</p>
 *
 * @author liuhy
 * @date 2021/8/19
 */
public enum MunicipalityEnums {

    BEIJING("110000", "北京市"),
    TIANJIN("120000", "天津市"),
    SHANGHAI("310000", "上海市"),
    CHONGQING("500000", "重庆市")
    ;

    /**
     * 根据名称判断其是否位直辖市
     * @param name 待判断的城市名称
     * @return true -> 是直辖市; false -> 不是直辖市
     */
    public static boolean isMunicipality(String name) {
        return Arrays.stream(values()).anyMatch(m -> m.getName().equals(name));
    }

    private String code;
    private String name;

    MunicipalityEnums(String code, String name) {
        this.code = code;
        this.name = name;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}
